﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace YXChatFormClient.Utility
{
    /// <summary>
    /// 获取服务器图片
    /// </summary>
    public class ImageHelper
    {
        public static Image RequestGetImage(string requestUrl)
        {
            return Image.FromStream(WebRequest.Create(requestUrl).GetResponse().GetResponseStream());
        }

        public static string GetStaticImage(string imgName)
        {
            return Path.Combine(Application.StartupPath, $"imgs/{imgName}");
        }

        public static string GetServerImage(string url)
        {
            return Path.Combine(HttpHelper.BASE_ADDRESS, url);
        }
    }
}
